home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / ModuleSources / CALookup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-26  |  3.3 KB  |  103 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Module Name:    CALookup                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        CALookup.c                                                                    */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1991-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1991-07-16    Jaakko Railo        Original version                                        */
  15. /*                                                                                                */
  16. /************************************************************************************************/
  17.  
  18. /****************************************** DESCRIPTION ******************************************
  19.  
  20. This module calls TELCALookup with different IntExt parameter.
  21.  
  22. *************************************************************************************************/
  23.  
  24. /******************************************** HEADERS *******************************************/
  25.  
  26. #include "TestModule.h"
  27.  
  28. /****************************************** DEFINITIONS *****************************************/
  29.  
  30. /****************************************** PROTOTYPES ******************************************/
  31.  
  32. void     DoTest (CHRSPtr paramPtr);
  33.  
  34. /************************************************************************************************/
  35. /************************************************************************************************/
  36.  
  37.  
  38. pascal short TestModule (CHRSPtr paramPtr)
  39. {
  40.     short    returnValue = noErr;
  41.     
  42.     if (paramPtr->version <= kTestModuleVersion) {
  43.         
  44.         DoTest (paramPtr);
  45.         
  46.     }
  47.     else
  48.         returnValue = kWrongVersion;
  49.         
  50.     return (returnValue);
  51. }
  52.  
  53.  
  54. void DoTest (CHRSPtr paramPtr)
  55. {
  56.     TELHandle    termHand = GetCurrentTELHandle (paramPtr);
  57.     TELDNHandle    dnHand;
  58.     TELCAHandle    caHand;
  59.     OSErr        errCode;
  60.     short        numOfCAs, index;
  61.         
  62.     if ((dnHand = GetDNHandle (paramPtr)) != nil) {
  63.         numOfCAs = TELCountCAs (dnHand, telAllCallOrigins);
  64.         Print (paramPtr, "Number of CAs found = %d", numOfCAs);
  65.         
  66.         for (index = 1; index <= numOfCAs; ++index) {
  67.             if ((errCode = TELCALookup (dnHand, telAllCallOrigins, index, &caHand)) == noErr) {
  68.                 
  69.                 Print (paramPtr, "CAHand (telAllCallOrigins) = %08x", caHand);
  70.  
  71.                 if ((errCode = TELCADispose (caHand)) != noErr)
  72.                     Print (paramPtr, "### TELCADispose fails : %d", errCode);
  73.             }
  74.             else
  75.                 Print (paramPtr, "### TELCALookup (telAllCallOrigins) fails : %d", errCode);
  76.  
  77.             if ((errCode = TELCALookup (dnHand, telInternalCall, index, &caHand)) == noErr) {
  78.                 
  79.                 Print (paramPtr, "CAHand (telInternalCall) = %08x", caHand);
  80.  
  81.                 if ((errCode = TELCADispose (caHand)) != noErr)
  82.                     Print (paramPtr, "### TELCADispose fails : %d", errCode);
  83.             }
  84.             else
  85.                 Print (paramPtr, "### TELCALookup (telInternalCall) fails : %d", errCode);
  86.  
  87.             if ((errCode = TELCALookup (dnHand, telExternalCall, index, &caHand)) == noErr) {
  88.                 
  89.                 Print (paramPtr, "CAHand (telExternalCall) = %08x", caHand);
  90.  
  91.                 if ((errCode = TELCADispose (caHand)) != noErr)
  92.                     Print (paramPtr, "### TELCADispose fails : %d", errCode);
  93.             }
  94.             else
  95.                 Print (paramPtr, "### TELCALookup (telExternalCall) fails : %d", errCode);
  96.         }
  97.     }
  98.     else
  99.         Print (paramPtr, "### Unable to retrieve the DN handle");
  100. }
  101.  
  102.  
  103.